/*
 ============================================================================
 Name		: YuebaoMagazineAppUi.cpp
 Author	  : 
 Copyright   :
 Description : CYuebaoMagazineAppUi implementation
 ============================================================================
 */

// INCLUDE FILES
#include <avkon.hrh>
#include <aknmessagequerydialog.h>
#include <aknnotewrappers.h>
#include <stringloader.h>
#include <f32file.h>
#include <s32file.h>

#include <bautils.h>
#include <charconv.h>
#include <libc\sys\reent.h>
#include <aknsoundsystem.h>

#include <YuebaoMagazine_0xE964C41C.rsg>

#include "YuebaoMagazine.hrh"
#include "YuebaoMagazine.pan"
#include "YuebaoMagazineApplication.h"
#include "YuebaoMagazineAppUi.h"
#include "YuebaoMagazineAppView.h"
#include "MagazineFramework.h"
#include "MemoryStateMonitor.h"
// ============================ MEMBER FUNCTIONS ===============================


// -----------------------------------------------------------------------------
// CYuebaoMagazineAppUi::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//


void CYuebaoMagazineAppUi::ConstructL()
{
    // Initialise app UI with standard value.
    BaseConstructL( CAknAppUi::EAknEnableSkin );

    KeySounds( )->PushContextL( R_AVKON_SILENT_SKEY_LIST );
    SetFullScreenApp( ETrue );
    SetOrientationL( EAppUiOrientationPortrait );

	#ifdef __WINS_CW__
    _monitor = CMemoryStateMonitor::NewL( );
    _monitor->DumpMemoryState( true );
    #endif//__WINS_CW__
    iAppView = CYuebaoMagazineAppView::NewL( ApplicationRect( ) );
    AddToStackL( iAppView );
    iAppView->Framework( )->StartL( 10 * 1000 );
    #ifdef __WINS_CW__
	_monitor->StartL( );
	#endif//__WINS_CW__
}

TKeyResponse CYuebaoMagazineAppUi::HandleKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
{
    return iAppView->Framework( )->ProcessKey( aKeyEvent, aType );
}

// -----------------------------------------------------------------------------
// CYuebaoMagazineAppUi::CYuebaoMagazineAppUi()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CYuebaoMagazineAppUi::CYuebaoMagazineAppUi()
{
    // No implementation required
}

// -----------------------------------------------------------------------------
// CYuebaoMagazineAppUi::~CYuebaoMagazineAppUi()
// Destructor.
// -----------------------------------------------------------------------------
//
CYuebaoMagazineAppUi::~CYuebaoMagazineAppUi()
{
    if( iAppView )
    {
        RemoveFromStack( iAppView );
        delete iAppView;
        iAppView = NULL;
    }
#ifdef __WINS_CW__
    delete _monitor;
#endif// __WINS_CW__
    CloseSTDLIB( );
}

// -----------------------------------------------------------------------------
// CYuebaoMagazineAppUi::HandleCommandL()
// Takes care of command handling.
// -----------------------------------------------------------------------------
//
void CYuebaoMagazineAppUi::HandleCommandL(TInt aCommand)
{
    switch( aCommand )
    {
        case EEikCmdExit:
        case EAknSoftkeyExit:
            Exit( );
            break;
        default:
            Panic( EYuebaoMagazineUi);
            break;
    }
}
// -----------------------------------------------------------------------------
//  Called by the framework when the application status pane
//  size is changed.  Passes the new client rectangle to the
//  AppView
// -----------------------------------------------------------------------------
//
void CYuebaoMagazineAppUi::HandleStatusPaneSizeChange()
{
    iAppView->SetRect( ApplicationRect( ) );
}
// End of File
